/******************************************************************************
 * * ril.h - implementation of RIL interface
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#ifndef RIL_H
#define RIL_H

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    RIL_SIM_1 = 0,
    RIL_SIM_2,
    RIL_SIM_NUM
} RIL_SIM_ID;

typedef enum {
    RIL_E_SUCCESS                          = 0,
    RIL_E_RADIO_NOT_AVAILABLE              = 1, /* If radio did not start or is resetting */
    RIL_E_GENERIC_FAILURE                  = 2,
    RIL_E_PASSWORD_INCORRECT               = 3, /* for PIN/PIN2 methods only! */
    RIL_E_SIM_PIN2                         = 4, /* Operation requires SIM PIN2 to be entered */
    RIL_E_SIM_PUK2                         = 5, /* Operation requires SIM PIN2 to be entered */
    RIL_E_REQUEST_NOT_SUPPORTED            = 6,
    RIL_E_CANCELLED                        = 7,
    RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL = 8,  /* data ops are not allowed during voice
                                                  * call on a Class C GPRS device */
    RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW  = 9,  /* data ops are not allowed before device
                                                  * registers in network */
    RIL_E_SMS_SEND_FAIL_RETRY              = 10, /* fail to send sms and need retry */
    RIL_E_SIM_ABSENT                       = 11, /* fail to set the location where CDMA subscription
                                                  * shall be retrieved because of SIM or RUIM
                                                  * card absent */
    RIL_E_SUBSCRIPTION_NOT_AVAILABLE       = 12, /* fail to find CDMA subscription from specified
                                                  * location */
    RIL_E_MODE_NOT_SUPPORTED               = 13, /* HW does not support preferred network type */
    RIL_E_FDN_CHECK_FAILURE                = 14, /* command failed because recipient is not on FDN list */
    RIL_E_ILLEGAL_SIM_OR_ME                = 15, /* network selection failed due to
                                                  * illegal SIM or ME */
    RIL_E_MISSING_RESOURCE                 = 16, /* no logical channel available */
    RIL_E_NO_SUCH_ELEMENT                  = 17, /* application not found on SIM */
    RIL_E_DIAL_MODIFIED_TO_USSD            = 18, /* DIAL request modified to USSD */
    RIL_E_DIAL_MODIFIED_TO_SS              = 19, /* DIAL request modified to SS */
    RIL_E_DIAL_MODIFIED_TO_DIAL            = 20, /* DIAL request modified to DIAL with different
                                                  * data */
    RIL_E_USSD_MODIFIED_TO_DIAL            = 21, /* USSD request modified to DIAL */
    RIL_E_USSD_MODIFIED_TO_SS              = 22, /* USSD request modified to SS */
    RIL_E_USSD_MODIFIED_TO_USSD            = 23, /* USSD request modified to different USSD
                                                  * request */
    RIL_E_SS_MODIFIED_TO_DIAL              = 24, /* SS request modified to DIAL */
    RIL_E_SS_MODIFIED_TO_USSD              = 25, /* SS request modified to USSD */
    RIL_E_SUBSCRIPTION_NOT_SUPPORTED       = 26, /* Subscription not supported by RIL */
    RIL_E_SS_MODIFIED_TO_SS                = 27, /* SS request modified to different SS request */
    RIL_E_LCE_NOT_SUPPORTED                = 36, /* LCE service not supported(36 in RILConstants.java) */
    RIL_E_NO_MEMORY                        = 37, /* Not sufficient memory to process the request */
    RIL_E_INTERNAL_ERR                     = 38, /* Modem hit unexpected error scenario while handling
                                                  * this request */
    RIL_E_SYSTEM_ERR                       = 39, /* Hit platform or system error */
    RIL_E_MODEM_ERR                        = 40, /* Vendor RIL got unexpected or incorrect response
                                                  * from modem for this request */
    RIL_E_INVALID_STATE                    = 41, /* Unexpected request for the current state */
    RIL_E_NO_RESOURCES                     = 42, /* Not sufficient resource to process the request */
    RIL_E_SIM_ERR                          = 43, /* Received error from SIM card */
    RIL_E_INVALID_ARGUMENTS                = 44, /* Received invalid arguments in request */
    RIL_E_INVALID_SIM_STATE                = 45, /* Can not process the request in current SIM state */
    RIL_E_INVALID_MODEM_STATE              = 46, /* Can not process the request in current Modem state */
    RIL_E_INVALID_CALL_ID                  = 47, /* Received invalid call id in request */
    RIL_E_NO_SMS_TO_ACK                    = 48, /* ACK received when there is no SMS to ack */
    RIL_E_NETWORK_ERR                      = 49, /* Received error from network */
    RIL_E_REQUEST_RATE_LIMITED             = 50, /* Operation denied due to overly-frequent requests */
    RIL_E_SIM_BUSY                         = 51, /* SIM is busy */
    RIL_E_SIM_FULL                         = 52, /* The target EF is full */
    RIL_E_NETWORK_REJECT                   = 53, /* Request is rejected by network */
    RIL_E_OPERATION_NOT_ALLOWED            = 54, /* Not allowed the request now */
    RIL_E_EMPTY_RECORD                     = 55, /* The request record is empty */
    RIL_E_INVALID_SMS_FORMAT               = 56, /* Invalid sms format */
    RIL_E_ENCODING_ERR                     = 57, /* Message not encoded properly */
    RIL_E_INVALID_SMSC_ADDRESS             = 58, /* SMSC address specified is invalid */
    RIL_E_NO_SUCH_ENTRY                    = 59, /* No such entry present to perform the request */
    RIL_E_NETWORK_NOT_READY                = 60, /* Network is not ready to perform the request */
    RIL_E_NOT_PROVISIONED                  = 61, /* Device doesnot have this value provisioned */
    RIL_E_NO_SUBSCRIPTION                  = 62, /* Device doesnot have subscription */
    RIL_E_NO_NETWORK_FOUND                 = 63, /* Network cannot be found */
    RIL_E_DEVICE_IN_USE                    = 64, /* Operation cannot be performed because the device
                                                  * is currently in use */
    RIL_E_ABORTED                          = 65, /* Operation aborted */
    RIL_E_INVALID_RESPONSE                 = 66, /* Invalid response sent by vendor code */
    // OEM specific error codes. To be used by OEM when they don't want to reveal
    // specific error codes which would be replaced by Generic failure.
    RIL_E_OEM_ERROR_1                      = 501,
    RIL_E_OEM_ERROR_2                      = 502,
    RIL_E_OEM_ERROR_3                      = 503,
    RIL_E_OEM_ERROR_4                      = 504,
    RIL_E_OEM_ERROR_5                      = 505,
    RIL_E_OEM_ERROR_6                      = 506,
    RIL_E_OEM_ERROR_7                      = 507,
    RIL_E_OEM_ERROR_8                      = 508,
    RIL_E_OEM_ERROR_9                      = 509,
    RIL_E_OEM_ERROR_10                     = 510,
    RIL_E_OEM_ERROR_11                     = 511,
    RIL_E_OEM_ERROR_12                     = 512,
    RIL_E_OEM_ERROR_13                     = 513,
    RIL_E_OEM_ERROR_14                     = 514,
    RIL_E_OEM_ERROR_15                     = 515,
    RIL_E_OEM_ERROR_16                     = 516,
    RIL_E_OEM_ERROR_17                     = 517,
    RIL_E_OEM_ERROR_18                     = 518,
    RIL_E_OEM_ERROR_19                     = 519,
    RIL_E_OEM_ERROR_20                     = 520,
    RIL_E_OEM_ERROR_21                     = 521,
    RIL_E_OEM_ERROR_22                     = 522,
    RIL_E_OEM_ERROR_23                     = 523,
    RIL_E_OEM_ERROR_24                     = 524,
    RIL_E_OEM_ERROR_25                     = 525
} RIL_Errno;

typedef enum {
    RIL_CALL_ACTIVE   = 0,
    RIL_CALL_HOLDING  = 1,
    RIL_CALL_DIALING  = 2,   /* MO call only */
    RIL_CALL_ALERTING = 3,   /* MO call only */
    RIL_CALL_INCOMING = 4,   /* MT call only */
    RIL_CALL_WAITING  = 5,   /* MT call only */
    RIL_CALL_INVALID  = 6    /* no call present */
} RIL_CallState;

/* User-to-User signaling Info activation types derived from 3GPP 23.087 v8.0 */
typedef enum {
    RIL_UUS_TYPE1_IMPLICIT     = 0,
    RIL_UUS_TYPE1_REQUIRED     = 1,
    RIL_UUS_TYPE1_NOT_REQUIRED = 2,
    RIL_UUS_TYPE2_REQUIRED     = 3,
    RIL_UUS_TYPE2_NOT_REQUIRED = 4,
    RIL_UUS_TYPE3_REQUIRED     = 5,
    RIL_UUS_TYPE3_NOT_REQUIRED = 6
} RIL_UUS_Type;

/* User-to-User Signaling Information data coding schemes. Possible values for
 * Octet 3 (Protocol Discriminator field) in the UUIE. The values have been
 * specified in section 10.5.4.25 of 3GPP TS 24.008 */
typedef enum {
    RIL_UUS_DCS_USP    = 0,       /* User specified protocol */
    RIL_UUS_DCS_OSIHLP = 1,       /* OSI higher layer protocol */
    RIL_UUS_DCS_X244   = 2,       /* X.244 */
    RIL_UUS_DCS_RMCF   = 3,       /* Reserved for system mangement
                                   * convergence function */
    RIL_UUS_DCS_IA5c   = 4        /* IA5 characters */
} RIL_UUS_DCS;

/* User-to-User Signaling Information defined in 3GPP 23.087 v8.0
 * This data is passed in RIL_ExtensionRecord and rec contains this
 * structure when type is RIL_UUS_INFO_EXT_REC */
typedef struct {
    RIL_UUS_Type uusType;     /* UUS Type */
    RIL_UUS_DCS  uusDcs;      /* UUS Data Coding Scheme */
    int          uusLength;   /* Length of UUS Data */
    char         *uusData;    /* UUS Data */
} RIL_UUS_Info;

typedef struct {
    RIL_CallState state;
    int           index;              /* Connection Index for use with, eg, AT+CHLD */
    int           toa;                /* type of address, eg 145 = intl */
    char          isMpty;             /* nonzero if is mpty call */
    char          isMT;               /* nonzero if call is mobile terminated */
    char          als;                /* ALS line indicator if available
                                       * (0 = line 1) */
    char          isVoice;            /* nonzero if this is is a voice call */
    char          isVoicePrivacy;     /* nonzero if CDMA voice privacy mode is active */
    char          *number;            /* Remote party number */
    int           numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
    char          *name;              /* Remote party name */
    int           namePresentation;   /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
    RIL_UUS_Info  *uusInfo;           /* NULL or Pointer to User-User Signaling Information */
} RIL_Call;

/** Used by RIL_REQUEST_DIAL */
typedef struct {
    char *address;
    int  clir;
    /* (same as 'n' paremeter in TS 27.007 7.7 "+CLIR"
     * clir == 0 on "use subscription default value"
     * clir == 1 on "CLIR invocation" (restrict CLI presentation)
     * clir == 2 on "CLIR suppression" (allow CLI presentation)
     */
    RIL_UUS_Info *uusInfo;      /* NULL or Pointer to User-User Signaling Information */
} RIL_Dial;

/* See also com.android.internal.telephony.gsm.CallForwardInfo */
typedef struct {
    int status;                 /*
                                 * For RIL_REQUEST_QUERY_CALL_FORWARD_STATUS
                                 * status 1 = active, 0 = not active
                                 *
                                 * For RIL_REQUEST_SET_CALL_FORWARD:
                                 * status is:
                                 * 0 = disable
                                 * 1 = enable
                                 * 2 = interrogate
                                 * 3 = registeration
                                 * 4 = erasure
                                 */

    int reason;                 /* from TS 27.007 7.11 "reason" */
    int serviceClass;           /* From 27.007 +CCFC/+CLCK "class"
                                 * See table for Android mapping from
                                 * MMI service code
                                 * 0 means user doesn't input class */
    int  toa;                   /* "type" from TS 27.007 7.11 */
    char *number;               /* "number" from TS 27.007 7.11. May be NULL */
    int  timeSeconds;           /* for CF no reply only */
} RIL_CallForwardInfo;

typedef struct {
    RIL_Call *calls;
    int      count; /* count of calls */
} RIL_CC_REQUEST_GET_CURRENT_CALLS;

typedef struct {
    char dtmf;  /* a single character with one of 12 values: 0-9,*,# */
    int  duration;
} RIL_CC_REQUEST_DTMF;

typedef struct {
    RIL_CallForwardInfo *forward;
    int                 count; /* count of  call forward info */
} RIL_SS_REQUEST_QUERY_CALL_FORWARD_STATUS;

typedef struct {
    int status;  /* 0 for "disabled" and 1 for "enabled" */
    int classx;
} RIL_SS_REQUEST_QUERY_CALL_WAITING;

typedef struct {
    int mode;  /* 0 for "disabled" and 1 for "enabled" */
    int class; /* the TS 27.007 service class bit vector of services to modify */
} RIL_SS_REQUEST_SET_CALL_WAITING;

typedef struct {
    int  iMessageRef;  /* TP-Message-Reference for GSM,
                        * and BearerData MessageId for CDMA
                        * (See 3GPP2 C.S0015-B, v2.0, table 4.5-1). */
    char *pcAckPdu;    /* or NULL if n/a */
    int  iErrorCode;   /* See 3GPP 27.005, 3.2.5 for GSM/UMTS,
                        * 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA,
                        * -1 if unknown or not applicable*/
} RIL_SMS_RESPONSE;

typedef struct _RIL_MSG_RESPONSE_NEW_SMS {
    unsigned short usSmsLen;
    char           *pNewSms;
    RIL_SIM_ID     eSimId;
} RIL_MSG_RESPONSE_NEW_SMS;

typedef struct _RIL_MSG_REQUEST_SEND_SMS {
    unsigned short ucSmscAddrLen;
    char           *pcSmsc;
    unsigned short ucSmsPduLen;
    char           *pSmsPdu;
    RIL_SIM_ID     eSimId;
} RIL_MSG_REQUEST_SEND_SMS;

typedef struct _RIL_MSG_RESPONSE_SEND_SMS {
    RIL_SMS_RESPONSE *pSmsResponse;
    RIL_SIM_ID       eSimId;
} RIL_MSG_RESPONSE_SEND_SMS;

typedef struct _RIL_SMS_WRITEARGS {
    int iStatus;     /* Status of message.  See TS 27.005 3.1, "<stat>": */
                     /*      0 = "REC UNREAD"    */
                     /*      1 = "REC READ"      */
                     /*      2 = "STO UNSENT"    */
                     /*      3 = "STO SENT"      */
    char *pcPdu;     /* PDU of message to write, as an ASCII hex string less the SMSC address,
                      * the TP-layer length is "strlen(pdu)/2". */
    char *pcSmsc;    /* SMSC address in GSM BCD format prefixed by a length byte
                      * (as expected by TS 27.005) or NULL for default SMSC */
} RIL_SMS_WRITEARGS;

typedef struct _RIL_MSG_REQUEST_WRITE_SMS_TO_SIM {
    RIL_SMS_WRITEARGS *pSmsWrite;
    RIL_SIM_ID        eSimId;
} RIL_MSG_REQUEST_WRITE_SMS_TO_SIM;

typedef struct _RIL_MSG_RESPONSE_WRITE_SMS_TO_SIM {
    unsigned long ulWriteIndex;           // return the write index
    RIL_SIM_ID    eSimId;
} RIL_MSG_RESPONSE_WRITE_SMS_TO_SIM;

typedef enum {
    MSG_SMS_UNREAD = 0,
    MSG_SMS_READ,
    MSG_SMS_UNSENT,
    MSG_SMS_SENT,
    MSG_SMS_ALL
} RIL_MSG_READ_SMS_TYPE;

typedef struct _RIL_MSG_REQUEST_READ_SINGLE_SMS_FROM_SIM {
    unsigned long ulReadIndex;
    RIL_SIM_ID    eSimId;
} RIL_MSG_REQUEST_READ_SINGLE_SMS_FROM_SIM;

typedef struct _RIL_MSG_RESPONSE_READ_SMS_FROM_SIM {
    RIL_MSG_READ_SMS_TYPE eReadSmsType;            // it should not use MSG_SMS_ALL to response
    unsigned short        usSmsPduLen;
    char                  *pcPdu;
    unsigned long         ulIndex;
    RIL_SIM_ID            eSimId;
} RIL_MSG_RESPONSE_READ_SMS_FROM_SIM;

typedef struct _RIL_MSG_RESPONSE_READ_SMS_INFO_FROM_SIM {
    unsigned short                     usSmsResCnt;
    RIL_MSG_RESPONSE_READ_SMS_FROM_SIM *pSmsResponse;
} RIL_MSG_RESPONSE_READ_SMS_INFO_FROM_SIM;

typedef struct _RIL_MSG_REQUEST_DELETE_SMS_ON_SIM {
    unsigned long ulDeleteIndex;
    RIL_SIM_ID    eSimId;
} RIL_MSG_REQUEST_DELETE_SMS_ON_SIM;

typedef struct {
    int           fromServiceId;
    int           toServiceId;
    int           fromCodeScheme;
    int           toCodeScheme;
    unsigned char selected;
} RIL_GSM_BroadcastSmsConfigInfo;

typedef struct _RIL_MSG_RESPONSE_GET_BROADCAST_SMS_CFG {
    unsigned short                 usCfgCnt;                        // max num = 40*40
    RIL_GSM_BroadcastSmsConfigInfo *pBrdcastSmsCfg;
    RIL_SIM_ID                     eSimId;
} RIL_MSG_RESPONSE_GET_BROADCAST_SMS_CFG;

typedef struct _RIL_MSG_REQUEST_SET_BROADCAST_SMS_CFG {
    unsigned short                 usCfgCnt;                        // max num = 40*40
    RIL_GSM_BroadcastSmsConfigInfo *pBrdcastSmsCfg;
    RIL_SIM_ID                     eSimId;
} RIL_MSG_REQUEST_SET_BROADCAST_SMS_CFG;

typedef struct _RIL_MSG_REQUEST_SMS_BROADCAST_ACT {
#define RIL_BROADCAST_ACTIVATE    0
#define RIL_BROADCAST_TURN_OFF    1
    unsigned char ucBroadcastActFlg;
    RIL_SIM_ID    eSimId;
} RIL_MSG_REQUEST_SMS_BROADCAST_ACT;

typedef struct _RIL_MSG_RESPONSE_GET_SMSC_ADDRESS {
    unsigned short ucSmscAddrLen;
    char           *pcSmsc;
    RIL_SIM_ID     eSimId;
} RIL_MSG_RESPONSE_GET_SMSC_ADDRESS;

typedef struct _RIL_MSG_REQUEST_SET_SMSC_ADDRESS {
    unsigned short ucSmscAddrLen;
    char           *pcSmsc;
    RIL_SIM_ID     eSimId;
} RIL_MSG_REQUEST_SET_SMSC_ADDRESS;

typedef enum {
    RIL_SMS_SUCCESS = 0,
    RIL_SMS_MEM_FULL,
    RIL_SMS_GENERAL
} RIL_DEV_SMS_ACKNOWLEDGE;

typedef struct _RIL_MSG_REQUEST_ACK_INCOME_SMS_WITH_PDU {
    RIL_DEV_SMS_ACKNOWLEDGE SmsAck;
    unsigned short          ucAckPduLen;
    char                    *pcAckPdu;
    RIL_SIM_ID              eSimId;
} RIL_MSG_REQUEST_ACK_INCOME_SMS_WITH_PDU;

typedef struct _RIL_MSG_RESPONSE_SMS_STATUS_REP {
    unsigned short ucSmsStsRepLen;
    char           *pSmsStatusRep;
    RIL_SIM_ID     eSimId;
} RIL_MSG_RESPONSE_SMS_STATUS_REP;

typedef struct _RIL_MSG_RESPONSE_SMS_STORAGE_STATUS {
#define RIL_SIM_READY_FOR_SMS       1
    unsigned char ucSimReady;
#define RIL_SIM_NOT_FULL_FOR_SMS    0
#define RIL_SIM_FULL_FOR_SMS        1
    unsigned char ucSimFull;
    RIL_SIM_ID    eSimId;
} RIL_MSG_RESPONSE_SMS_STORAGE_STATUS;

typedef struct _RIL_MSG_RESPONSE_NEW_SMS_ON_SIM {
    int        iIndex;
    RIL_SIM_ID eSimId;
} RIL_MSG_RESPONSE_NEW_SMS_ON_SIM;

typedef struct _RIL_DEV_REQUEST_GET_IMEI {
    unsigned char ucImeiLen;
    char          *pcStrImei;
} RIL_DEV_REQUEST_GET_IMEI;

typedef struct _RIL_DEV_REQUEST_GET_IMEISV {
    unsigned char ucStrImeisv;
    char          *pcStrImeisv;
} RIL_DEV_REQUEST_GET_IMEISV;

typedef struct _RIL_DEV_REQUEST_DEVICE_ID {
    unsigned char ucImeiLen;
    char          *pcStrImei;
    unsigned char ucImeisvLen;
    char          *pcStrImeisv;
} RIL_DEV_REQUEST_DEVICE_ID;

typedef struct _RIL_DEV_REQUEST_BASEBAND_VERSION {
    unsigned char ucStringLen;
    char          *pcStrBasebandVer;
} RIL_DEV_REQUEST_BASEBAND_VERSION;

typedef struct _RIL_DEV_REQUEST_SMS_ACKNOWLEDGE {
    RIL_DEV_SMS_ACKNOWLEDGE eSmsAck;
    RIL_SIM_ID              eSimId;
} RIL_DEV_REQUEST_SMS_ACKNOWLEDGE;

typedef struct _RIL_DEV_REQUEST_OEM_HOOK_RAW {
    unsigned char ucDataLen;
    char          *pData;
} RIL_DEV_REQUEST_OEM_HOOK_RAW;
typedef struct _RIL_DEV_RESPONSE_OEM_HOOK_RAW {
    unsigned char ucResLen;
    char          *pResponse;
} RIL_DEV_RESPONSE_OEM_HOOK_RAW;

typedef struct _RIL_DEV_REQUEST_OEM_HOOK_STRING {
    unsigned char ucDataLen;
    char          *pData;
} RIL_DEV_REQUEST_OEM_HOOK_STRING;

typedef struct _RIL_DEV_RESPONSE_OEM_HOOK_STRING {
    unsigned char ucResLen;
    char          *pResponse;
} RIL_DEV_RESPONSE_OEM_HOOK_STRING;

typedef enum {
    RC_PHASE_CONFIGURED = 0,  // LM is configured is initial value and value after FINISH completes
    RC_PHASE_START      = 1,  // START is sent before Apply and indicates that an APPLY will be
                              // forthcoming with these same parameters
    RC_PHASE_APPLY      = 2,  // APPLY is sent after all LM's receive START and returned
                              // RIL_RadioCapability.status = 0, if any START's fail no
                              // APPLY will be sent
    RC_PHASE_UNSOL_RSP  = 3,  // UNSOL_RSP is sent with RIL_UNSOL_RADIO_CAPABILITY
    RC_PHASE_FINISH     = 4   // FINISH is sent after all commands have completed. If an error
                              // occurs in any previous command the RIL_RadioAccessesFamily and
                              // logicalModemUuid fields will be the prior configuration thus
                              // restoring the configuration to the previous value. An error
                              // returned by this command will generally be ignored or may
                              // cause that logical modem to be removed from service.
} RadioCapabilityPhase;

typedef enum {
    RC_STATUS_NONE    = 0,    // This parameter has no meaning with RC_PHASE_START,
                              // RC_PHASE_APPLY
    RC_STATUS_SUCCESS = 1,    // Tell modem the action transaction of set radio
                              // capability was success with RC_PHASE_FINISH
    RC_STATUS_FAIL    = 2,    // Tell modem the action transaction of set radio
                              // capability is fail with RC_PHASE_FINISH.
} RadioCapabilityStatus;

typedef enum {
    RADIO_TECH_UNKNOWN  = 0,
    RADIO_TECH_GPRS     = 1,
    RADIO_TECH_EDGE     = 2,
    RADIO_TECH_UMTS     = 3,
    RADIO_TECH_IS95A    = 4,
    RADIO_TECH_IS95B    = 5,
    RADIO_TECH_1xRTT    = 6,
    RADIO_TECH_EVDO_0   = 7,
    RADIO_TECH_EVDO_A   = 8,
    RADIO_TECH_HSDPA    = 9,
    RADIO_TECH_HSUPA    = 10,
    RADIO_TECH_HSPA     = 11,
    RADIO_TECH_EVDO_B   = 12,
    RADIO_TECH_EHRPD    = 13,
    RADIO_TECH_LTE      = 14,
    RADIO_TECH_HSPAP    = 15, // HSPA+
    RADIO_TECH_GSM      = 16, // Only supports voice
    RADIO_TECH_TD_SCDMA = 17,
    RADIO_TECH_IWLAN    = 18,
    RADIO_TECH_LTE_CA   = 19
} RIL_RadioTechnology;

typedef enum {
    RAF_UNKNOWN  = (1 << RADIO_TECH_UNKNOWN),
    RAF_GPRS     = (1 << RADIO_TECH_GPRS),
    RAF_EDGE     = (1 << RADIO_TECH_EDGE),
    RAF_UMTS     = (1 << RADIO_TECH_UMTS),
    RAF_IS95A    = (1 << RADIO_TECH_IS95A),
    RAF_IS95B    = (1 << RADIO_TECH_IS95B),
    RAF_1xRTT    = (1 << RADIO_TECH_1xRTT),
    RAF_EVDO_0   = (1 << RADIO_TECH_EVDO_0),
    RAF_EVDO_A   = (1 << RADIO_TECH_EVDO_A),
    RAF_HSDPA    = (1 << RADIO_TECH_HSDPA),
    RAF_HSUPA    = (1 << RADIO_TECH_HSUPA),
    RAF_HSPA     = (1 << RADIO_TECH_HSPA),
    RAF_EVDO_B   = (1 << RADIO_TECH_EVDO_B),
    RAF_EHRPD    = (1 << RADIO_TECH_EHRPD),
    RAF_LTE      = (1 << RADIO_TECH_LTE),
    RAF_HSPAP    = (1 << RADIO_TECH_HSPAP),
    RAF_GSM      = (1 << RADIO_TECH_GSM),
    RAF_TD_SCDMA = (1 << RADIO_TECH_TD_SCDMA),
    RAF_LTE_CA   = (1 << RADIO_TECH_LTE_CA)
} RIL_RadioAccessFamily;

typedef struct _RIL_DEV_REQUEST_GET_RADIO_CAPABILITY {
#define RIL_RADIO_CAPABILITY_VERSION    1
    unsigned char         ucVersion;                          // Version of structure, RIL_RADIO_CAPABILITY_VERSION
    int                   iSession;                           // Unique session value defined by framework returned in all "responses/unsol"
    RadioCapabilityPhase  ePhase;                             // CONFIGURED, START, APPLY, FINISH
    RIL_RadioAccessFamily eRat;                               // RIL_RadioAccessFamily for the radio
#define MAX_UUID_LENGTH    64
    char                  cLogicalModemUuid[MAX_UUID_LENGTH]; // A UUID typically "com.xxxx.lmX where X is the logical modem.
    RadioCapabilityStatus eStatus;                            // Return status and an input parameter for RC_PHASE_FINISH
    RIL_Errno             RilResult;
} RIL_DEV_REQUEST_GET_RADIO_CAPABILITY;

#define RIL_CARD_MAX_APPS    8

typedef enum {
    RIL_CARDSTATE_ABSENT     = 0,
    RIL_CARDSTATE_PRESENT    = 1,
    RIL_CARDSTATE_ERROR      = 2,
    RIL_CARDSTATE_RESTRICTED = 3  /* card is present but not usable due to carrier restrictions.*/
} RIL_CardState;

typedef enum {
    RIL_APPSTATE_UNKNOWN  = 0,
    RIL_APPSTATE_DETECTED = 1,
    RIL_APPSTATE_PIN      = 2,              /* If PIN1 or UPin is required */
    RIL_APPSTATE_PUK      = 3,              /* If PUK1 or Puk for UPin is required */
    RIL_APPSTATE_SUBSCRIPTION_PERSO = 4,    /* perso_substate should be look at
                                             * when app_state is assigned to this value */
    RIL_APPSTATE_READY    = 5
} RIL_AppState;

typedef enum {
    RIL_PINSTATE_UNKNOWN              = 0,
    RIL_PINSTATE_ENABLED_NOT_VERIFIED = 1,
    RIL_PINSTATE_ENABLED_VERIFIED     = 2,
    RIL_PINSTATE_DISABLED             = 3,
    RIL_PINSTATE_ENABLED_BLOCKED      = 4,
    RIL_PINSTATE_ENABLED_PERM_BLOCKED = 5
} RIL_PinState;

typedef enum {
    RIL_APPTYPE_UNKNOWN = 0,
    RIL_APPTYPE_SIM     = 1,
    RIL_APPTYPE_USIM    = 2,
    RIL_APPTYPE_RUIM    = 3,
    RIL_APPTYPE_CSIM    = 4,
    RIL_APPTYPE_ISIM    = 5
} RIL_AppType;

typedef enum {
    RIL_PERSOSUBSTATE_UNKNOWN                   = 0, /* initial state */
    RIL_PERSOSUBSTATE_IN_PROGRESS               = 1, /* in between each lock transition */
    RIL_PERSOSUBSTATE_READY                     = 2, /* when either SIM or RUIM Perso is finished
                                                      * since each app can only have 1 active perso
                                                      * involved */
    RIL_PERSOSUBSTATE_SIM_NETWORK               = 3,
    RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET        = 4,
    RIL_PERSOSUBSTATE_SIM_CORPORATE             = 5,
    RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER      = 6,
    RIL_PERSOSUBSTATE_SIM_SIM                   = 7,
    RIL_PERSOSUBSTATE_SIM_NETWORK_PUK           = 8, /* The corresponding perso lock is blocked */
    RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK    = 9,
    RIL_PERSOSUBSTATE_SIM_CORPORATE_PUK         = 10,
    RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK  = 11,
    RIL_PERSOSUBSTATE_SIM_SIM_PUK               = 12,
    RIL_PERSOSUBSTATE_RUIM_NETWORK1             = 13,
    RIL_PERSOSUBSTATE_RUIM_NETWORK2             = 14,
    RIL_PERSOSUBSTATE_RUIM_HRPD                 = 15,
    RIL_PERSOSUBSTATE_RUIM_CORPORATE            = 16,
    RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER     = 17,
    RIL_PERSOSUBSTATE_RUIM_RUIM                 = 18,
    RIL_PERSOSUBSTATE_RUIM_NETWORK1_PUK         = 19, /* The corresponding perso lock is blocked */
    RIL_PERSOSUBSTATE_RUIM_NETWORK2_PUK         = 20,
    RIL_PERSOSUBSTATE_RUIM_HRPD_PUK             = 21,
    RIL_PERSOSUBSTATE_RUIM_CORPORATE_PUK        = 22,
    RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23,
    RIL_PERSOSUBSTATE_RUIM_RUIM_PUK             = 24
} RIL_PersoSubstate;

typedef struct {
    RIL_AppType       app_type;
    RIL_AppState      app_state;
    RIL_PersoSubstate perso_substate; /* applicable only if app_state ==
                                       *  RIL_APPSTATE_SUBSCRIPTION_PERSO */
    char              *aid_ptr;       /* null terminated string, e.g., from 0xA0, 0x00 -> 0x41,
                                       * 0x30, 0x30, 0x30 */
    char              *app_label_ptr; /* null terminated string */
    int               pin1_replaced;  /* applicable to USIM, CSIM & ISIM */
    RIL_PinState      pin1;
    RIL_PinState      pin2;
} RIL_AppStatus;

typedef struct {
    RIL_CardState card_state;
    RIL_PinState  universal_pin_state;             /* applicable to USIM and CSIM: RIL_PINSTATE_xxx */
    int           gsm_umts_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
    int           cdma_subscription_app_index;     /* value < RIL_CARD_MAX_APPS, -1 if none */
    int           ims_subscription_app_index;      /* value < RIL_CARD_MAX_APPS, -1 if none */
    int           num_applications;                /* value <= RIL_CARD_MAX_APPS */
    RIL_AppStatus applications[RIL_CARD_MAX_APPS];
} RIL_CardStatus;

typedef struct CPPhoneBook_s {
    int total;
    int used;
    int firstIndex;
} CPPhoneBook;

typedef struct {
    char *tel_number;
    char *name;
    int  index;
    int  nextindex;             // AT*CPBR should be used for phone book read
} RIL_Contact;

typedef struct
{
    int firstIndex;
    int endIndex;
} RIL_ReadPbIndex;

typedef struct {
    char *p_puk;
    char *p_newPin;
} RIL_SIM_REQUEST_ENTER_PUK;

typedef struct {
    char *p_oldPin;
    char *p_newPin;
} RIL_SIM_REQUEST_CHANGE_PIN;

typedef struct {
    int  command;   /* one of the commands listed for TS 27.007 +CRSM*/
    int  fileid;    /* EF id */
    char *path;     /* "pathid" from TS 27.007 +CRSM command.
                     * Path is in hex asciii format eg "7f205f70"
                     */
    int  p1;
    int  p2;
    int  p3;
    char *data;     /* May be NULL*/
    char *pin2;     /* May be NULL*/
} RIL_SIM_IO;

typedef struct {
    int  sw1;
    int  sw2;
    char *simResponse;  /* In hex string format ([a-fA-F0-9]*), except for SIM_AUTHENTICATION
                         * response for which it is in Base64 format, see 3GPP TS 31.102 7.1.2 */
} RIL_SIM_IO_Response;

typedef struct {
    int signalStrength;  /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
    int bitErrorRate;    /* bit error rate (0-7, 99) as defined in TS 27.007 8.5 */
} RIL_GW_SignalStrength;

typedef struct {
    int signalStrength;  /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
    int rsrp;            /* The current Reference Signal Receive Power in dBm multipled by -1.
                          * Range: 44 to 140 dBm
                          * INT_MAX: 0x7FFFFFFF denotes invalid value.
                          * Reference: 3GPP TS 36.133 9.1.4 */
    int rsrq;            /* The current Reference Signal Receive Quality in dB multiplied by -1.
                          * Range: 20 to 3 dB.
                          * INT_MAX: 0x7FFFFFFF denotes invalid value.
                          * Reference: 3GPP TS 36.133 9.1.7 */
    int rssnr;           /* The current reference signal signal-to-noise ratio in 0.1 dB units.
                          * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
                          * INT_MAX : 0x7FFFFFFF denotes invalid value.
                          * Reference: 3GPP TS 36.101 8.1.1 */
    int cqi;             /* The current Channel Quality Indicator.
                          * Range: 0 to 15.
                          * INT_MAX : 0x7FFFFFFF denotes invalid value.
                          * Reference: 3GPP TS 36.101 9.2, 9.3, A.4 */
    int timingAdvance;   /* timing advance in micro seconds for a one way trip from cell to device.
                          * Approximate distance can be calculated using 300m/us * timingAdvance.
                          * Range: 0 to 0x7FFFFFFE
                          * INT_MAX : 0x7FFFFFFF denotes invalid value.
                          * Reference: 3GPP 36.321 section 6.1.3.5
                          * also: http://www.cellular-planningoptimization.com/2010/02/timing-advance-with-calculation.html */
} RIL_LTE_SignalStrength_v8;

typedef struct {
    RIL_GW_SignalStrength     GW_SignalStrength;
    RIL_LTE_SignalStrength_v8 LTE_SignalStrength;
} RIL_SignalStrength;

typedef struct {
    int stat;            /* <stat>: integer type; circuit mode registration status
                          * 0: not registered, MT is not currently searching a new operator to register to
                          * 1: registered, home network
                          * 2: not registered, but MT is currently searching a new operator to register to
                          * 3: registration denied
                          * 4: unknown
                          * 5: registered, roaming
                          * 6: registered for "SMS only", home network (applicable only when <AcT> indicates E-UTRAN)
                          * 7: registered for "SMS only", roaming (applicable only when <AcT> indicates E-UTRAN)
                          * 8: attached for emergency bearer services only (see NOTE 2) (not applicable)
                          * 9: registered for "CSFB not preferred", home network (applicable only when <AcT> indicates E-UTRAN)
                          * 10: registered for "CSFB not preferred", roaming (applicable only when <AcT> indicates E-UTRAN)
                          * 11: only emergency services are available.
                          * 12: registeration denied in roaming
                          * 13: sync done in LTE roaming network
                          * 14: ecall inactive */
    int lac;             /* <lac>: string type; two byte location area code in hexadecimal format */
    int cid;             /* <ci>: string type; four byte cell identifier in hexadecimal format.
                          * GSM case: 16 least significant bits ,WCDMA case: CellId - 16 least significant bits ,RNCID - 12 most significant bits */
    int act;             /* <AcT>: integer type; access technology of the serving cell
                          * 0: GSM
                          * 1: GSM Compact
                          * 2: UTRAN
                          * 3: GSM w/EGPRS
                          * 4: UTRAN w/HSDPA
                          * 5: UTRAN w/HSUPA
                          * 6: UTRAN w/HSDPA and HSUPA
                          * 7: E-UTRAN
                          * 8: UTRAN w/HSPA+ */
    int causeType;       /* <cause_type>: integer type; indicates the type of <reject_cause>.
                          * 0: Indicates that <reject_cause> contains an MM cause value, see 3GPP TS 24.008 [8] Annex G.
                          * 1: Indicates that <reject_cause> contains a manufacturer specific cause. */
    int rejectCause;     /* <reject_cause>: integer type; contains the cause of the failed registration. The value is of type as defined by <cause_type> */
    int psc;             /* only valid for CREG */
} RIL_RegState;

typedef struct {
    int state;           /* <stat>: integer type
                          * 0 unknown
                          * 1 available
                          * 2 current
                          * 3 forbidden */
#define RIL_MM_MAX_OPER_ID_LENGTH    32
    char operLongStr[RIL_MM_MAX_OPER_ID_LENGTH + 1];
    char operShortStr[RIL_MM_MAX_OPER_ID_LENGTH + 1];
    char operNumStr[RIL_MM_MAX_OPER_ID_LENGTH + 1];
    int  act;            /* <AcT> integer type; access technology selected:
                          * 0: GSM
                          * 1: GSM Compact
                          * 2: UTRAN
                          * 3: GSM EGPRS
                          * 4: UTRAN HSDPA
                          * 5: UTRAN HSUPA
                          * 6: UTRAN HSPA
                          * 7: EUTRAN */
} RIL_OperInfoSub;

typedef struct {
    RIL_OperInfoSub *pOperInfoSub;
    int             operInfoNum;
} RIL_OperInfo;

typedef enum {
    PREF_NET_TYPE_GSM_WCDMA                         = 0,  /* GSM/WCDMA (WCDMA preferred) */
    PREF_NET_TYPE_GSM_ONLY                          = 1,  /* GSM only */
    PREF_NET_TYPE_WCDMA                             = 2,  /* WCDMA  */
    PREF_NET_TYPE_GSM_WCDMA_AUTO                    = 3,  /* GSM/WCDMA (auto mode, according to PRL) */
    PREF_NET_TYPE_CDMA_EVDO_AUTO                    = 4,  /* CDMA and EvDo (auto mode, according to PRL) */
    PREF_NET_TYPE_CDMA_ONLY                         = 5,  /* CDMA only */
    PREF_NET_TYPE_EVDO_ONLY                         = 6,  /* EvDo only */
    PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO          = 7,  /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) */
    PREF_NET_TYPE_LTE_CDMA_EVDO                     = 8,  /* LTE, CDMA and EvDo */
    PREF_NET_TYPE_LTE_GSM_WCDMA                     = 9,  /* LTE, GSM/WCDMA */
    PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA           = 10, /* LTE, CDMA, EvDo, GSM/WCDMA */
    PREF_NET_TYPE_LTE_ONLY                          = 11, /* LTE only */
    PREF_NET_TYPE_LTE_WCDMA                         = 12, /* LTE/WCDMA */
    PREF_NET_TYPE_TD_SCDMA_ONLY                     = 13, /* TD-SCDMA only */
    PREF_NET_TYPE_TD_SCDMA_WCDMA                    = 14, /* TD-SCDMA and WCDMA */
    PREF_NET_TYPE_TD_SCDMA_LTE                      = 15, /* TD-SCDMA and LTE */
    PREF_NET_TYPE_TD_SCDMA_GSM                      = 16, /* TD-SCDMA and GSM */
    PREF_NET_TYPE_TD_SCDMA_GSM_LTE                  = 17, /* TD-SCDMA,GSM and LTE */
    PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA                = 18, /* TD-SCDMA, GSM/WCDMA */
    PREF_NET_TYPE_TD_SCDMA_WCDMA_LTE                = 19, /* TD-SCDMA, WCDMA and LTE */
    PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_LTE            = 20, /* TD-SCDMA, GSM/WCDMA and LTE */
    PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO = 21, /* TD-SCDMA, GSM/WCDMA, CDMA and EvDo */
    PREF_NET_TYPE_TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA  = 22  /* TD-SCDMA, LTE, CDMA, EvDo GSM/WCDMA */
} RIL_PreferredNetworkType;

typedef struct {
#define RIL_MM_MAX_NITZ_TIME_LENGTH    25
    char NitzTimeData[RIL_MM_MAX_NITZ_TIME_LENGTH];
    int  NitzTimeDataSize;
} RIL_NitzTimeInfo;

typedef struct {
    unsigned short mcc;
    unsigned short mnc;
    unsigned short tac;
    unsigned short euarfcn;
    unsigned int   cellid;
    unsigned int   rsrp;
    unsigned int   rsrq;
} RIL_Lte_Scell_Info;

typedef struct {
    unsigned char  index;
    unsigned short euarfcn;
    unsigned int   phycellid;
    unsigned int   cellid;
    unsigned int   rsrp;
    unsigned int   rsrq;
} RIL_Lte_Ncell_Info;

typedef struct {
    unsigned short mcc;
    unsigned short mnc;
    unsigned short lac;
    unsigned short arfcn;
    unsigned char  bsic;
    unsigned int   cellid;
    unsigned char  rxlev;
} RIL_Gsm_Cell_Info;

typedef struct {
    unsigned char  Number;
    RIL_Gsm_Cell_Info *Ncell;  // Number * sizeof(RIL_Gsm_Cell_Info)
} RIL_Gsm_NCell_Info;

/* interface for SERVICE DEV begin */
/**
 * RIL_DEV_REQUEST_GET_IMEI
 * param       RIL_DEV_REQUEST_GET_IMEI pImei
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_DEV_Request_Get_Imei(RIL_SIM_ID simId, RIL_DEV_REQUEST_GET_IMEI *pImei);

/**
 * RIL_DEV_REQUEST_GET_IMEISV
 * param       RIL_DEV_REQUEST_GET_IMEISV pImeisv
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_DEV_Request_Get_Imeisv(RIL_SIM_ID simId, RIL_DEV_REQUEST_GET_IMEISV *pImeisv);

/**
 * RIL_DEV_REQUEST_BASEBAND_VERSION
 * param       RIL_DEV_REQUEST_BASEBAND_VERSION pBasebandVer
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_DEV_Request_Baseband_Version(RIL_DEV_REQUEST_BASEBAND_VERSION *pBasebandVer);

/**
 * RIL_DEV_REQUEST_OEM_HOOK_RAW
 * param       RIL_DEV_REQUEST_OEM_HOOK_RAW pOemHookRawReq
 *             RIL_DEV_RESPONSE_OEM_HOOK_RAW pOemHookRawRes
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_DEV_Request_Oem_Hook_Raw(RIL_DEV_REQUEST_OEM_HOOK_RAW *pOemHookRawReq, RIL_DEV_RESPONSE_OEM_HOOK_RAW *pOemHookRawRes);

/**
 * RIL_DEV_REQUEST_OEM_HOOK_STRING
 * param       RIL_DEV_REQUEST_OEM_HOOK_STRING pOemHookStrReq
 *             RIL_DEV_RESPONSE_OEM_HOOK_STRING pOemHookStrRes
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_DEV_Request_Oem_Hook_String(RIL_DEV_REQUEST_OEM_HOOK_STRING *pOemHookStrReq, RIL_DEV_RESPONSE_OEM_HOOK_STRING *pOemHookStrRes);

/**
 * RIL_DEV_REQUEST_DEVICE_ID
 * param       RIL_DEV_REQUEST_DEVICE_ID pDeviceId
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_DEV_Request_Device_Id(RIL_DEV_REQUEST_DEVICE_ID *pDeviceId);

/* interface for SERVICE DEV end */

/* interface for SERVICE SIM begin */
/**
 * RIL_REQUEST_GET_CP_PHONEBOOK_STATUS(AT+CPBS?)
 * Request CP phonebook status
 * param   RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_SIM_Request_Get_Phonebook_Status(RIL_SIM_ID simId);

/**
 * RIL_RESPONSE_GET_CP_PHONEBOOK_STATUS(AT+CPBS?)
 * Response for getting CP phonebook status
 * param   RIL_SIM_ID SimId: SIM ID
 *         CPPhoneBook *p_phonebook: phonebook status
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR
 * return  void
 */
extern void Ril_SIM_Response_Get_Phonebook_Status(RIL_SIM_ID SimId, CPPhoneBook *p_phonebook, RIL_Errno result);

/**
 * RIL_REQUEST_WRITE_PHONEBOOK(AT+CPBW=)
 * Request CP to write new contact into phonebook
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_Contact *p_contact: the contact to be written into phonebook
 * return  void
 */
extern void Ril_SIM_Request_Write_Phonebook(RIL_SIM_ID SimId, RIL_Contact *p_contact);

/**
 * RIL_RESPONSE_WRITE_PHONEBOOK(AT+CPBW=)
 * Response for writting new contact into phonebook
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_writtenIndex: the written index of the contact
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR
 * return  void
 */
extern void Ril_SIM_Response_Write_Phonebook(RIL_SIM_ID SimId, int *p_writtenIndex, RIL_Errno result);

/**
 * RIL_REQUEST_READ_PHONEBOOK(AT+CPBR=)
 * Request CP to read contacts from phonebook
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_ReadPbIndex index: first and end index of contact to read
 * return  void
 */
extern void Ril_SIM_Request_Read_Phonebook(RIL_SIM_ID simId, RIL_ReadPbIndex index);

/**
 * RIL_RESPONSE_READ_PHONEBOOK(AT+CPBR=)
 * Response for reading contacts from phonebook
 * param   RIL_SIM_ID SimId: SIM ID
 *         RIL_Contact *p_contact: the contact read from phonebook
 *         int count: the count of contacts
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR
 * return  void
 */
extern void Ril_SIM_Response_Read_Phonebook(RIL_SIM_ID SimId, RIL_Contact *p_contact, int count, RIL_Errno result);

/**
 * RIL_REQUEST_GET_SIM_STATUS(AT+CPIN?)
 * Request status of the SIM interface and the SIM card
 * param   RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_SIM_Request_Get_Sim_Status(RIL_SIM_ID simId);

/**
 * RIL_RESPONSE_GET_SIM_STATUS(AT+CPIN?)
 * Response for getting status of the SIM interface and the SIM card
 * param   RIL_SIM_ID SimId: SIM ID
 *         RIL_CardStatus *p_card_status: SIM card status
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR
 * return  void
 */
extern void Ril_SIM_Response_Get_Sim_Status(RIL_SIM_ID SimId, RIL_CardStatus *p_cardStatus, RIL_Errno result);

/**
 * RIL_REQUEST_QUERY_FACILITY_LOCK
 *
 * Query the status of a facility lock state
 *
 * "data" is const char **
 * ((const char **)data)[0] is the facility string code from TS 27.007 7.4
 *                      (eg "AO" for BAOC, "SC" for SIM lock)
 * ((const char **)data)[1] is the password, or "" if not required
 * ((const char **)data)[2] is the TS 27.007 service class bit vector of
 *                           services to query
 * ((const char **)data)[3] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
 *                            This is only applicable in the case of Fixed Dialing Numbers
 *                            (FDN) requests.
 *
 * "response" is an int *
 * ((int *)response) 0 is the TS 27.007 service class bit vector of
 *                           services for which the specified barring facility
 *                           is active. "0" means "disabled for all"
 *
 *
 * return  RIL_Errno: RIL_E_SUCCESS, RIL_E_xxx
 * Valid errors:
 *  SUCCESS
 *  RADIO_NOT_AVAILABLE
 *  SS_MODIFIED_TO_DIAL
 *  SS_MODIFIED_TO_USSD
 *  SS_MODIFIED_TO_SS
 *  INVALID_ARGUMENTS
 *  NO_MEMORY
 *  INTERNAL_ERR
 *  SYSTEM_ERR
 *  MODEM_ERR
 *  FDN_CHECK_FAILURE
 *  NO_RESOURCES
 *  CANCELLED
 *  REQUEST_NOT_SUPPORTED
 *
 * return  void
 */
extern RIL_Errno Ril_SIM_Request_Query_Facility_Lock(RIL_SIM_ID SimId, const unsigned char **data, int *response);

/**
 * RIL_REQUEST_SET_FACILITY_LOCK
 *
 * Enable/disable one facility lock
 *
 * "data" is const char **
 *
 * ((const char **)data)[0] = facility string code from TS 27.007 7.4
 * (eg "AO" for BAOC)
 * ((const char **)data)[1] = "0" for "unlock" and "1" for "lock"
 * ((const char **)data)[2] = password
 * ((const char **)data)[3] = string representation of decimal TS 27.007
 *                            service class bit vector. Eg, the string
 *                            "1" means "set this facility for voice services"
 * ((const char **)data)[4] = AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
 *                            This is only applicable in the case of Fixed Dialing Numbers
 *                            (FDN) requests.
 *
 * "response" is int *
 * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
 *
 * return  RIL_Errno: RIL_E_SUCCESS, RIL_E_xxx
 * Valid errors:
 *  SUCCESS
 *  RADIO_NOT_AVAILABLE
 *  SS_MODIFIED_TO_DIAL
 *  SS_MODIFIED_TO_USSD
 *  SS_MODIFIED_TO_SS
 *  INVALID_ARGUMENTS
 *  INTERNAL_ERR
 *  NO_MEMORY
 *  MODEM_ERR
 *  INVALID_STATE
 *  FDN_CHECK_FAILURE
 *  NO_RESOURCES
 *  CANCELLED
 *  REQUEST_NOT_SUPPORTED
 *
 */
extern RIL_Errno Ril_SIM_Request_Set_Facility_Lock(RIL_SIM_ID SimId, const char **data, int *response);

/**
 * RIL_REQUEST_GET_IMSI(AT+CIMI)
 * Request to get the SIM IMSI
 * param   RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_SIM_Request_Get_Imsi(RIL_SIM_ID SimId);

/**
 * RIL_RESPONSE_GET_IMSI(AT+CIMI)
 * Response for getting the SIM IMSI
 * param   RIL_SIM_ID SimId: SIM ID
 *         char *p_imsi: IMSI
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR
 * return  void
 */
extern void Ril_SIM_Response_Get_Imsi(RIL_SIM_ID SimId, char *p_imsi, RIL_Errno result);


/**
 * RIL_REQUEST_LOCK_INFO(AT+EPIN)
 * Request to get PIN/PUK lock info
 * param   RIL_SIM_ID SimId: SIM ID
 * return  void
 */
extern void Ril_SIM_Request_Query_Lock_Info(RIL_SIM_ID SimId);

/**
 * RIL_REQUEST_LOCK_INFO(AT+EPIN)
 * Response for getting PIN/PUK lock info
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *response:
 * ((int *)response)[0] PIN1 retried left
 * ((int *)response)[1] PIN2 retried left
 * ((int *)response)[2] PUK1 retried left
 * ((int *)response)[3] PUK2 retried left
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR
 * return  void
 */
extern void Ril_SIM_Response_Query_Lock_Info(RIL_SIM_ID SimId, int *response, RIL_Errno result);

/**
 * RIL_REQUEST_ENTER_SIM_PIN(AT+CPIN=)
 * Request to enter SIM PIN
 * param   RIL_SIM_ID simId: SIM ID
 *         char *p_pin: PIN string
 * return  void
 */
extern void Ril_SIM_Request_Enter_Sim_Pin(RIL_SIM_ID SimId, char *p_pin);

/**
 * RIL_RESPONSE_ENTER_SIM_PIN(AT+CPIN=)
 * Response for entering SIM PIN
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_retryLeft: the number of retries remaining, or -1 if unknown
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR and CME errors
 * return  void
 */
extern void Ril_SIM_Response_Enter_Sim_Pin(RIL_SIM_ID SimId, int *p_retryLeft, RIL_Errno result);

/**
 * RIL_REQUEST_ENTER_SIM_PUK(ATD**05*)
 * Request to enter SIM PUK and new PIN
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_SIM_REQUEST_ENTER_PUK *p_pukAndPin: PUK and new PIN string
 * return  void
 */
extern void Ril_SIM_Request_Enter_Sim_Puk(RIL_SIM_ID simId, RIL_SIM_REQUEST_ENTER_PUK *p_pukAndPin);

/**
 * RIL_RESPONSE_ENTER_SIM_PUK(ATD**05*)
 * Response for entering SIM PUK and new PIN
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_retryLeft: the number of retries remaining, or -1 if unknown
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR, RIL_E_MODEM_ERR and CME errors
 * return  void
 */
extern void Ril_SIM_Response_Enter_Sim_Puk(RIL_SIM_ID SimId, int *p_retryLeft, RIL_Errno result);

/**
 * RIL_REQUEST_ENTER_SIM_PIN2(AT+CPIN=)
 * Request to enter SIM PIN2
 * param   RIL_SIM_ID simId: SIM ID
 *         char *p_pin2: PIN2 string
 * return  void
 */
extern void Ril_SIM_Request_Enter_Sim_Pin2(RIL_SIM_ID SimId, char *p_pin2);

/**
 * RIL_RESPONSE_ENTER_SIM_PIN2(AT+CPIN=)
 * Response for entering SIM PIN2
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_retryLeft: the number of retries remaining, or -1 if unknown
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR and CME errors
 * return  void
 */
extern void Ril_SIM_Response_Enter_Sim_Pin2(RIL_SIM_ID SimId, int *p_retryLeft, RIL_Errno result);

/**
 * RIL_REQUEST_ENTER_SIM_PUK2(ATD**052*)
 * Request to enter SIM PUK2 and new PIN2.
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_SIM_REQUEST_ENTER_PUK *p_puk2AndPin2: PUK2 and new PIN2 string
 * return  void
 */
extern void Ril_SIM_Request_Enter_Sim_Puk2(RIL_SIM_ID simId, RIL_SIM_REQUEST_ENTER_PUK *p_puk2AndPin2);

/**
 * RIL_RESPONSE_ENTER_SIM_PUK2(ATD**052*)
 * Response for entering SIM PUK2 and new PIN2.
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_retryLeft: the number of retries remaining, or -1 if unknown
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR, RIL_E_MODEM_ERR and other errors
 * return  void
 */
extern void Ril_SIM_Response_Enter_Sim_Puk2(RIL_SIM_ID SimId, int *p_retryLeft, RIL_Errno result);

/**
 * RIL_REQUEST_CHANGE_SIM_PIN(AT+CPIN= , )
 * Request to enter old SIM PIN and new PIN.
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_SIM_REQUEST_CHANGE_PIN *p_changePin: the old PIN2 and new PIN string
 * return  void
 */
extern void Ril_SIM_Request_Change_Sim_Pin(RIL_SIM_ID simId, RIL_SIM_REQUEST_CHANGE_PIN *p_changePin);

/**
 * RIL_RESPONSE_CHANGE_SIM_PIN(AT+CPIN= , )
 * Response for entering old SIM PIN and new PIN.
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_retryLeft: the number of retries remaining, or -1 if unknown
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR and CME errors
 * return  void
 */
extern void Ril_SIM_Response_Change_Sim_Pin(RIL_SIM_ID SimId, int *p_retryLeft, RIL_Errno result);

/**
 * RIL_REQUEST_CHANGE_SIM_PIN2(AT+CPWD=\"P2\", , )
 * Request to enter old SIM PIN2 and new PIN2.
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_SIM_REQUEST_CHANGE_PIN *p_changePin2: the old PIN2 and new PIN2 string
 * return  void
 */
extern void Ril_SIM_Request_Change_Sim_Pin2(RIL_SIM_ID simId, RIL_SIM_REQUEST_CHANGE_PIN *p_changePin2);

/**
 * RIL_RESPONSE_CHANGE_SIM_PIN2(AT+CPWD=\"P2\", , )
 * Response for entering old SIM PIN2 and new PIN2.
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_retryLeft: the number of retries remaining, or -1 if unknown
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR and CME errors
 * return  void
 */
extern void Ril_SIM_Response_Change_Sim_Pin2(RIL_SIM_ID SimId, int *p_retryLeft, RIL_Errno result);

/**
 * RIL_REQUEST_SIM_IO(AT+CRLA= / AT+CRSM=)
 * Request SIM I/O operation.
 * This is similar to the TS 27.007 "restricted SIM" operation
 * where it assumes all of the EF selection will be done by the
 * callee.
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_SIM_IO *p_data: data for SIM IO request
 * return  void
 */
extern void Ril_SIM_Request_Sim_Io(RIL_SIM_ID simId, RIL_SIM_IO *p_data);

/**
 * RIL_RESPONSE_SIM_IO(AT+CRLA= / AT+CRSM=)
 * Response for SIM I/O operation.
 * This is similar to the TS 27.007 "restricted SIM" operation
 * where it assumes all of the EF selection will be done by the
 * callee.
 * param   RIL_SIM_ID SimId: SIM ID
 *         RIL_SIM_IO_Response *p_sr: response for SIM IO request
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR, RIL_E_SIM_PIN2, RIL_E_SIM_PUK2, RIL_E_PASSWORD_INCORRECT
 * return  void
 */
extern void Ril_SIM_Response_Sim_Io(RIL_SIM_ID SimId, RIL_SIM_IO_Response *p_sr, RIL_Errno result);

/**
 * RIL_REQUEST_SIM_OPEN_CHANNEL(AT+CCHO=, AT+CGLA=)
 * Open a new logical channel and select the given application. This command
 * reflects TS 27.007 "open logical channel" operation (+CCHO). This request
 * also specifies the P2 parameter (described in ISO 7816-4).
 * param   RIL_SIM_ID simId: SIM ID
 *         char *p_data: a const RIL_OpenChannelParam
 * return  void
 */
extern void Ril_SIM_Request_Sim_Open_Channel(RIL_SIM_ID simId, char *p_data);

/**
 * RIL_RESPONSE_SIM_OPEN_CHANNEL(AT+CCHO=, AT+CGLA=)
 * Open a new logical channel and select the given application. This command
 * reflects TS 27.007 "open logical channel" operation (+CCHO). This request
 * also specifies the P2 parameter (described in ISO 7816-4).
 * param   RIL_SIM_ID SimId: SIM ID
 *         int *p_openChannelResponse: ((int *)p_sr)[0] contains the session id of the logical channel;
 *                                     ((int *)p_sr)[1] onwards may optionally contain the select
 *                                     response for the open channel command with one byte per integer.
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_MODEM_ERR
 * return  void
 */
extern void Ril_SIM_Response_Sim_Open_Channel(RIL_SIM_ID SimId, int *p_openChannelResponse, RIL_Errno result);

/**
 * RIL_REQUEST_SIM_CLOSE_CHANNEL(AT+CCHC=)
 * Close a previously opened logical channel. This command reflects TS 27.007
 * "close logical channel" operation (+CCHC).
 * param   RIL_SIM_ID simId: SIM ID
 *         int sessionId: the session ID of logical the channel to close.
 * return  void
 */
extern void Ril_SIM_Request_Sim_Close_Channel(RIL_SIM_ID simId, int sessionId);

/**
 * RIL_RESPONSE_SIM_CLOSE_CHANNEL(AT+CCHC=)
 * Close a previously opened logical channel. This command reflects TS 27.007
 * "close logical channel" operation (+CCHC).
 * param   RIL_SIM_ID SimId: SIM ID
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INVALID_ARGUMENTS
 * return  void
 */
extern void Ril_SIM_Response_Sim_Close_Channel(RIL_SIM_ID SimId, RIL_Errno result);

/**
 * RIL_UNSOL_CP_PHONEBOOK_INITED
 * Indicate When phonebook has been loaded by CP
 * param   RIL_SIM_ID SimId: SIM ID
 * return  void
 */
extern void Ril_SIM_Response_Cp_Phonebook_Inited(RIL_SIM_ID SimId);

/**
 * RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED(AT*EUICC?)
 * Indicates that SIM state changes.
 * Callee will invoke RIL_REQUEST_GET_SIM_STATUS on main thread
 * param   RIL_SIM_ID SimId: SIM ID
 * return  void
 */
extern void Ril_SIM_Response_Sim_Status_Changed(RIL_SIM_ID SimId);

/* interface for SERVICE SIM end */

/* interface for SERVICE MM begin */

/*
 * RIL_REQUEST_SIGNAL_STRENGTH(AT+CSQ, AT+CESQ)
 * Request current signal strength and bit error rate
 * param   RIL_SignalStrength *pSignalStrength: returned to upper layer, signal strength
 *         RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Signal_Strength(RIL_SignalStrength *pSignalStrength, RIL_SIM_ID simId);

/*
 * RIL_REQUEST_VOICE_REGISTRATION_STATE(AT$CREG?)
 * Request current voice registration state
 * param   RIL_RegState *pRegState: returned to upper layer, voice registration state
 *         RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Voice_Registration_state(RIL_RegState *pRegState, RIL_SIM_ID simId);

/*
 * RIL_REQUEST_OPERATOR(AT+COPS=3,0;+COPS?;AT+COPS=3,1;+COPS?;AT+COPS=3,2;+COPS?)
 * Request current operator ONS or EONS
 * param   RIL_RegState *pRegState: returned to upper layer, voice operator information
 *         RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Operator(RIL_OperInfo *pOperInfo, RIL_SIM_ID simId);

/*
 * RIL_REQUEST_RADIO_POWER(AT+CFUN=1)
 * Power on command for flight mode
 * param(in)   RIL_SIM_ID simId: SIM ID
 * param(in)   RadioOn simId: BOOL true to turn on the radio power, false to turn off the radio power
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Radio_Power(RIL_SIM_ID simId, unsigned char RadioOn);

/*
 * RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE(AT+COPS?)
 * Query current network selection mode
 * param   RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Query_Network_Selection_Mode(RIL_SIM_ID simId);

/*
 * RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC(AT+COPS?)
 * Specify that the network should be selected automatically
 * param   RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_INTERNAL_ERR)
 */
extern RIL_Errno Ril_MM_Request_Set_Network_Selection_Automatic(RIL_SIM_ID simId);

/*
 * RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL(AT+COPS=1,2,)
 * Manually select a specified network
 * param   RIL_OperInfo operInfo: parameter of setting network selection manual
 *         RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern RIL_Errno Ril_MM_Request_Set_Network_Selection_Manual(RIL_OperInfo operInfo, RIL_SIM_ID simId);

/*
 * RIL_RESPONSE_SET_NETWORK_SELECTION_MANUAL
 * Response of selecting a specified network Manually
 * param   RIL_SIM_ID simId: SIM ID
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR
 * return void
 */
extern void Ril_MM_Response_Set_Network_Selection_Manual(RIL_Errno result, RIL_SIM_ID simId);

/*
 * RIL_REQUEST_QUERY_AVAILABLE_NETWORKS(AT+COPS=?)
 * Scans for available networks
 * param   RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern RIL_Errno Ril_MM_Request_Query_Available_Networks(RIL_SIM_ID simId);

/*
 * RIL_RESPONSE_QUERY_AVAILABLE_NETWORKS
 * Response of Scaning for available networks
 * param   RIL_OperInfo *pOperInfo: returned to upper layer, list of available network
 *         RIL_SIM_ID simId: SIM ID
 *         RIL_Errno result: RIL_E_SUCCESS, RIL_E_INTERNAL_ERR
 * return  void
 */
extern void Ril_MM_Response_Query_Available_Networks(RIL_OperInfo *pOperInfo, RIL_SIM_ID simId, RIL_Errno result);

/*
 * RIL_REQUEST_RESET_RADIO(AT+CFUN=4, AT+CFUN=1)
 * Reset radio according to CFUN4 and CFUN1
 * param   RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Reset_Radio(RIL_SIM_ID simId);

/*
 * RIL_REQUEST_SCREEN_STATE(AT*POWERIND=0, AT*POWERIND=1)
 * Notify CP that AP will wake or sleep
 * param   RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_MM_Request_Screen_State(void);

/*
 * RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE(AT*BAND?, )
 * Request to set the preferred network type of searching and registering
 * param   RIL_PreferredNetworkType NetworkType: index of RILNetworkTypeTostarBandNetworkType[]
 *         RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR, RIL_E_MODE_NOT_SUPPORRTED)
 */
extern RIL_Errno Ril_MM_Request_Set_Preferred_Network_Type(RIL_PreferredNetworkType NetworkType, RIL_SIM_ID simId);

/*
 * RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE(AT*BAND?)
 * Query the preferred network type for searching and registering
 * param   RIL_PreferredNetworkType *pNetworkType: returned to upper layer, network type
 *         RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Get_Preferred_Network_Type(RIL_PreferredNetworkType *pNetworkType, RIL_SIM_ID simId);

/*
 * RIL_REQUEST_SET_LOCATION_UPDATES(AT+CREG=2)
 * Enables/Disable network state change notification due to change in LAC and/or CID
 * param   RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Set_Location_Updates(RIL_SIM_ID simId);

/*
 * RIL_REQUEST_SHUTDOWN(AT+CFUN=0)
 * Shurdown command
 * param   RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Shutdown(RIL_SIM_ID simId);

/*
 * RIL_REQUEST_CANCEL_PLMN_SEARCH(AT+CPLMNS)
 * Notify modem to cancell plmn search
 * param   RIL_SIM_ID simId: SIM ID
 * return  RIL_Errno(RIL_E_SUCCESS, RIL_E_MODEM_ERR)
 */
extern RIL_Errno Ril_MM_Request_Cancel_Plmn_Search(RIL_SIM_ID simId);

/*
 * RIL_UNSOL_SIGNAL_STRENGTH(+CSQ, +CESQ)
 * Report current signal strength
 * param   RIL_SignalStrength *pSignalStrength: report to upper layer, signal strength
 *         RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_MM_Response_Signal_Strength(RIL_SignalStrength *pSignalStrength, RIL_SIM_ID simId);

/*
 * RIL_UNSOL_VOICE_RADIO_TECH_CHANGED($CREG, +CGREG, +CEREG)
 * Report current network's radio technology
 * param   RIL_RadioTechnology *pRadioTech: report to upper layer, current radio technology
 *         RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_MM_Response_Radio_Tech_Changed(RIL_RadioTechnology *pRadioTech, RIL_SIM_ID simId);

/*
 * RIL_UNSOL_NITZ_TIME_RECEIVED(+NITZ)
 * Report current network time
 * param   RIL_NitzTimeInfo *pNitzTimeInfo: report to upper layer, current network time
 *         RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_MM_Response_Nitz_Time_Received(RIL_NitzTimeInfo *pNitzTimeInfo, RIL_SIM_ID simId);

/*
 * RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED(*COPN, $CREG, +CGREG, +CEREG)
 * Inform network state changed
 * param   RIL_SIM_ID simId: SIM ID
 * return  void
 */
extern void Ril_MM_Response_Network_State_Changed(RIL_SIM_ID simId);

/* interface for SERVICE MM end */

/* interface for SERVICE MSG begin */
/**
 * RIL_MSG_REQUEST_SEND_SMS
 * param       RIL_MSG_REQUEST_SEND_SMS pSendSmsReq
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Send_Sms(RIL_MSG_REQUEST_SEND_SMS *pSendSmsReq);

/**
 * RIL_MSG_RESPONSE_SEND_SMS
 * param       RIL_MSG_RESPONSE_SEND_SMS pSendSmsRes
 * return  void
 */
extern void Ril_MSG_Response_Send_Sms(RIL_MSG_RESPONSE_SEND_SMS *pSendSmsRes);

/**
 * RIL_MSG_REQUEST_WRITE_SMS_TO_SIM
 * param       RIL_MSG_REQUEST_WRITE_SMS_TO_SIM pWriteSmsReq
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Write_Sms_to_Sim(RIL_MSG_REQUEST_WRITE_SMS_TO_SIM *pWriteSmsReq);

/**
 * RIL_MSG_RESPONSE_WRITE_SMS_TO_SIM
 * param       RIL_MSG_RESPONSE_WRITE_SMS_TO_SIM pWriteSmsRes
 * return  void
 */
extern void Ril_MSG_Response_Write_Sms_to_Sim(RIL_MSG_RESPONSE_WRITE_SMS_TO_SIM *pWriteSmsRes);

/**
 * Ril_MSG_Request_Read_Sms_Info_From_Sim
 * param       RIL_MSG_READ_SMS_TYPE eReadSmsType
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Read_Sms_Info_From_Sim(RIL_MSG_READ_SMS_TYPE eReadSmsType);

/**
 * RIL_MSG_RESPONSE_READ_SMS_INFO_FROM_SIM
 * param       RIL_MSG_RESPONSE_READ_SMS_INFO_FROM_SIM pReadSmsRes
 * return  void
 */
extern void Ril_MSG_Response_Read_Sms_Info_From_Sim(RIL_MSG_RESPONSE_READ_SMS_INFO_FROM_SIM *pReadSmsRes);

/**
 * RIL_MSG_REQUEST_READ_SINGLE_SMS_FROM_SIM
 * param       RIL_MSG_REQUEST_READ_SINGLE_SMS_FROM_SIM pReadSingleSms
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Read_Single_Sms_From_Sim(RIL_MSG_REQUEST_READ_SINGLE_SMS_FROM_SIM *pReadSingleSms);

/**
 * RIL_MSG_RESPONSE_READ_SMS_FROM_SIM
 * param       RIL_MSG_RESPONSE_READ_SMS_FROM_SIM pReadSingleSmsRes
 * return  void
 */
extern void Ril_MSG_Response_Read_Single_Sms_From_Sim(RIL_MSG_RESPONSE_READ_SMS_FROM_SIM *pReadSingleSmsRes);

/**
 * RIL_MSG_REQUEST_DELETE_SMS_ON_SIM
 * param       RIL_MSG_REQUEST_DELETE_SMS_ON_SIM pDeleteSms
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Delete_Sms_On_Sim(RIL_MSG_REQUEST_DELETE_SMS_ON_SIM *pDeleteSms);

/**
 * Ril_MSG_Request_Get_Broadcast_Sms_Cfg
 * param       RIL_SIM_ID eSimId
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Get_Broadcast_Sms_Cfg(RIL_SIM_ID eSimId);

/**
 * RIL_MSG_RESPONSE_GET_BROADCAST_SMS_CFG
 * param       RIL_MSG_RESPONSE_GET_BROADCAST_SMS_CFG pGetBrdcastSmsCfg
 * return  void
 */
extern void Ril_MSG_Response_Get_Broadcast_Sms_Cfg(RIL_MSG_RESPONSE_GET_BROADCAST_SMS_CFG *pGetBrdcastSmsCfg);

/**
 * RIL_MSG_REQUEST_SET_BROADCAST_SMS_CFG
 * param       RIL_MSG_REQUEST_SET_BROADCAST_SMS_CFG pSetBrdcastSmsCfg
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Set_Broadcast_Sms_Cfg(RIL_MSG_REQUEST_SET_BROADCAST_SMS_CFG *pSetBrdcastSmsCfg);

/**
 * RIL_MSG_REQUEST_SMS_BROADCAST_ACT
 * param       RIL_MSG_REQUEST_SMS_BROADCAST_ACT pSmsBrdcastAct
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Sms_Broadcast_Act(RIL_MSG_REQUEST_SMS_BROADCAST_ACT *pSmsBrdcastAct);

/**
 * Ril_MSG_Request_Get_Smsc_Addr
 * param       RIL_SIM_ID eSimId
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Get_Smsc_Addr(RIL_SIM_ID eSimId);

/**
 * RIL_MSG_RESPONSE_GET_SMSC_ADDRESS
 * param       RIL_MSG_RESPONSE_GET_SMSC_ADDRESS pGetSmscAddr
 * return  void
 */
extern void Ril_MSG_Response_Get_Smsc_Addr(RIL_MSG_RESPONSE_GET_SMSC_ADDRESS *pGetSmscAddr);

/**
 * RIL_MSG_REQUEST_SET_SMSC_ADDRESS
 * param       RIL_MSG_REQUEST_SET_SMSC_ADDRESS pSetSmscAddr
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Set_Smsc_Addr(RIL_MSG_REQUEST_SET_SMSC_ADDRESS *pSetSmscAddr);

/**
 * RIL_MSG_REQUEST_ACK_INCOME_SMS_WITH_PDU
 * param       RIL_MSG_REQUEST_ACK_INCOME_SMS_WITH_PDU pAckWithPdu
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Ack_Incoming_Sms_With_Pdu(RIL_MSG_REQUEST_ACK_INCOME_SMS_WITH_PDU *pAckWithPdu);

/**
 * RIL_MSG_RESPONSE_NEW_SMS
 * param       RIL_MSG_RESPONSE_NEW_SMS pNewSms
 * return  void
 */
extern void Ril_MSG_Response_New_Sms(RIL_MSG_RESPONSE_NEW_SMS *pNewSms);

/**
 * RIL_MSG_RESPONSE_NEW_SMS_ON_SIM
 * param       RIL_MSG_RESPONSE_NEW_SMS_ON_SIM pNewSmsOnSim
 * return  void
 */
extern void Ril_MSG_Response_New_Sms_On_Sim(RIL_MSG_RESPONSE_NEW_SMS_ON_SIM *pNewSmsOnSim);

/**
 * RIL_MSG_RESPONSE_SMS_STATUS_REP
 * param       RIL_MSG_RESPONSE_SMS_STATUS_REP pSmsStsRep
 * return  void
 */
extern void Ril_MSG_Response_Sms_Status_Rep(RIL_MSG_RESPONSE_SMS_STATUS_REP *pSmsStsRep);

/**
 * RIL_MSG_RESPONSE_SMS_STORAGE_STATUS
 * param       RIL_MSG_RESPONSE_SMS_STORAGE_STATUS pSmsStorageSts
 * return  void
 */
extern void Ril_MSG_Response_Sms_Storage_Status(RIL_MSG_RESPONSE_SMS_STORAGE_STATUS *pSmsStorageSts);

/**
 * RIL_MSG_RESPONSE_NEW_SMS
 * param       RIL_MSG_RESPONSE_NEW_SMS pNewBroSms
 * return  void
 */
extern void Ril_MSG_Response_New_Broadcast_Sms(RIL_MSG_RESPONSE_NEW_SMS *pNewBroSms);

/**
 * RIL_DEV_REQUEST_SMS_ACKNOWLEDGE
 * param       RIL_DEV_SMS_ACKNOWLEDGE eSmsAck: Acknowledge
 * return  RIL_Errno result
 */
extern RIL_Errno Ril_MSG_Request_Sms_Acknowledge(RIL_DEV_REQUEST_SMS_ACKNOWLEDGE *pSmsAck);

/* interface for SERVICE MSG end */

/* interface for SERVICE CC begin */

/**
 * Requests current call list ( AT+CLCC)
 * param (in) sid:  RIL_SIM_ID
 * param (out) calls:  RIL_CC_REQUEST_GET_CURRENT_CALLS *   //caller alloc & free
 *                      typedef struct {
 *                      RIL_Call *calls;                    //caller alloc & free
 *                      int      count;
 *                      } RIL_CC_REQUEST_GET_CURRENT_CALLS;
 *
 *                     typedef struct {
 *                         RIL_CallState state;
 *                         int           index;
 *                         int           toa;
 *                         char          isMpty;
 *                         char          isMT;
 *                         char          als;
 *                         char          isVoice;
 *                         char          isVoicePrivacy;
 *                         char          *number;           //ril alloc, caller free
 *                         int           numberPresentation;
 *                         char          *name;             //ril alloc, caller free
 *                         int           namePresentation;
 *                         RIL_UUS_Info  *uusInfo;          //ril alloc, caller free
 *                     } RIL_Call;
 *
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Get_Current_Calls(RIL_SIM_ID sid, RIL_CC_REQUEST_GET_CURRENT_CALLS *calls);

/**
 * Initiate voice call ( ATD<dial string>; or AT*DIALE=<dial string>,<service Type>)
 * param (in) sid:  RIL_SIM_ID
 * param (in) dial:  RIL_Dial *
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Dial(RIL_SIM_ID sid, RIL_Dial *dial);

/**
 * Hang up a specific line (like AT+CHLD=1x)
 * param (in) sid:  RIL_SIM_ID
 * param (in) index:   Connection index (value of 'x' in CHLD above)
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Hangup(RIL_SIM_ID sid, int index);

/**
 * Hang up waiting or held (like AT+CHLD=0)
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Hangup_Waiting_Or_Background(RIL_SIM_ID sid);

/**
 * Hang up active, and resume waiting or held (like AT+CHLD=1)
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Hangup_Foreground_Resume_Background(RIL_SIM_ID sid);

/*
 * Switch waiting or holding call and active call (like AT+CHLD=2)
 *
 * State transitions should be is follows:
 *
 * If call 1 is waiting and call 2 is active, then if this re
 *
 *   BEFORE                               AFTER
 * Call 1   Call 2                 Call 1       Call 2
 * ACTIVE   HOLDING                HOLDING     ACTIVE
 * ACTIVE   WAITING                HOLDING     ACTIVE
 * HOLDING  WAITING                HOLDING     ACTIVE
 * ACTIVE   IDLE                   HOLDING     IDLE
 * IDLE     IDLE                   IDLE        IDLE
 *
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Switch_Waiting_Or_Holding_And_Active(RIL_SIM_ID sid);

/**
 * Conference holding and active (like AT+CHLD=3)
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Conference(RIL_SIM_ID sid);

/**
 * Separate a party from a multiparty call placing the multiparty call
 * (less the specified party) on hold and leaving the specified party
 * as the only other member of the current (active) call
 *
 * Like AT+CHLD=2x
 *
 * See TS 22.084 1.3.8.2 (iii)
 * TS 22.030 6.5.5 "Entering "2X followed by send"
 * TS 27.007 "AT+CHLD=2x"
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) index:   Connection index (value of 'x' in CHLD above)
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Separate_Connection(RIL_SIM_ID sid, int index);

/**
 * Connects the two calls and disconnects the subscriber from both calls (ECT). (AT+CHLD=4)
 *
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Explicit_Call_Transfer(RIL_SIM_ID sid);

/**
 * Send UDUB (user determined user busy) to ringing or
 * waiting call answer  (AT+CHLD=0)
 *
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Udub(RIL_SIM_ID sid);

/**
 * Answer incoming call (ATA)
 *
 * Will not be called for WAITING calls.
 * RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE will be used in this case instead
 *
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Answer(RIL_SIM_ID sid);

/**
 * Send a DTMF tone (AT+VTS=<DTMF>)
 *
 * If the implementation is currently playing a tone requested via
 * RIL_REQUEST_DTMF_START, that tone should be cancelled and the new tone
 * should be played instead
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) dtmf:  RIL_CC_REQUEST_DTMF *
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Dtmf(RIL_SIM_ID sid, RIL_CC_REQUEST_DTMF *dtmf);

/**
 * Start playing a DTMF tone. Continue playing DTMF tone until
 * RIL_REQUEST_DTMF_STOP is received (AT+VTS=<DTMF>)
 *
 * If a RIL_REQUEST_DTMF_START is received while a tone is currently playing,
 * it should cancel the previous tone and play the new one.
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) dtmf: a single character with one of 12 values: 0-9,*,#
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Dtmf_Start(RIL_SIM_ID sid, char dtmf);

/**
 * Stop playing a currently playing DTMF tone. (AT)
 *
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Dtmf_stop(RIL_SIM_ID sid);

/**
 * Turn on or off uplink (microphone) mute. ("AT+CMUT=<n>)
 *
 * Will only be sent while voice call is active.
 * Will always be reset to "disable mute" when a new voice call is initiated
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) mute:   1 for "enable mute" and 0 for "disable mute"
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Set_Mute(RIL_SIM_ID sid, int mute);

/**
 * Queries the current state of the uplink mute setting (AT+CMUT?)
 *
 * param (in) sid:  RIL_SIM_ID
 * param (out) mute:   1 for "mute enabled" and 0 for "mute disabled"
 * return  RIL_Errno
 */
extern RIL_Errno Ril_CC_Request_Get_Mute(RIL_SIM_ID sid, int *mute);

/**
 *
 * Indicates an incoming call (voice, data or fax) is indicated by the cellular network. (RING)
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_CC_Response_Ring(RIL_SIM_ID sid, const char *s);

/**
 * Indicates the type of incoming call when receive an incoming call. (+CRING:)
 * +CRING: <type>
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_CC_Response_CRing(RIL_SIM_ID sid, const char *s);

/**
 * Indicates a disconnect for Call Clearing or a Call Failed for an outgoing call. (NO CARRIER)
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_CC_Response_No_Carrier(RIL_SIM_ID sid, const char *s);

/**
 * CONNECT indication.
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_CC_Response_Connect(RIL_SIM_ID sid, const char *s);

/**
 * Indicates Call Waiting (CW) information (when enabled) for an incoming call. (+CCWA:)
 * +CCWA: <number>,<type>,<class>,[<alpha>][,<CLI validity>[,<subaddr>,<satype>[,<priority>]]]
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_CC_Response_Ccwa(RIL_SIM_ID sid, const char *s);

/**
 * Presents an indication to list the current call information. (+CLCC:)
 * [+CLCC: <id1>,<dir>,<stat>,<mode>,<mpty>[,<number>,<type>[,<alpha>]]
 * [<CR><LF>+CLCC:<id2>,<dir>,<stat>,<mode>,<mpty>[,<number>,<type>[,<alpha>]]
 * [...]]]
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_CC_Response_Clcc(RIL_SIM_ID sid, const char *s);

/**
 * Indicates the calling line identity of the calling party after every RING/+CRING. (+CLIP:)
 * +CLIP: <number>,<type>
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_CC_Response_Clip(RIL_SIM_ID sid, const char *s);

/* interface for SERVICE CC end */

/* interface for SERVICE SS begin */

/*
 * Send a USSD message (AT+CUSD=1,str,15)
 *
 * If a USSD session already exists, the message should be sent in the
 * context of that session. Otherwise, a new session should be created.
 *
 * The network reply should be reported via RIL_UNSOL_ON_USSD
 *
 * Only one USSD session may exist at a time, and the session is assumed
 * to exist until:
 *   a) The android system invokes RIL_REQUEST_CANCEL_USSD
 *   b) The implementation sends a RIL_UNSOL_ON_USSD with a type code
 *      of "0" (USSD-Notify/no further action) or "2" (session terminated)
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) str:    a char * containing the USSD request in UTF-8 format
 * return  RIL_Errno
 */
extern RIL_Errno Ril_SS_Request_Send_Ussd(RIL_SIM_ID sid, char *str);

/**
 * Cancel the current USSD session if one exists (AT+CUSD=2)
 *
 * param (in) sid:  RIL_SIM_ID
 * return  RIL_Errno
 */
extern RIL_Errno Ril_SS_Request_Cancel_Ussd(RIL_SIM_ID sid);

/**
 * Get call forward status
 * (AT+CCFC=<reason>,2,,,<class>)
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) forward:  RIL_CallForwardInfo *
 *
 * param (out) result:  RIL_SS_REQUEST_QUERY_CALL_FORWARD_STATUS *
 *
 * For example, if data is forwarded to +18005551212 and voice is forwarded
 * to +18005559999, then two separate RIL_CallForwardInfo's should be returned
 *
 * If, however, both data and voice are forwarded to +18005551212, then
 * a single RIL_CallForwardInfo can be returned with the service class
 * set to "data + voice = 3")
 *
 * return  RIL_Errno
 */
extern RIL_Errno Ril_SS_Request_Query_Call_Forward_Status(RIL_SIM_ID sid, RIL_CallForwardInfo *forward, RIL_SS_REQUEST_QUERY_CALL_FORWARD_STATUS *result);

/**
 * Configure call forward rule.
 * (AT+CCFC=<reason>,<mode>[,<number>[,<type>[,<class>[,<subaddr>[,<satype>[,<time>]]]]]])
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) forward:     RIL_CallForwardInfo *
 * return  RIL_Errno
 */
extern RIL_Errno Ril_SS_Request_Set_Call_Forward(RIL_SIM_ID sid, RIL_CallForwardInfo *forward);

/**
 * Query current call waiting state (AT+CCWA=1,2,class)
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) class:  the TS 27.007 service class to query.
 * param (out) result:  RIL_SS_REQUEST_QUERY_CALL_WAITING *
 *
 * If status = 1, then classx
 * must follow, with the TS 27.007 service class bit vector of services
 * for which call waiting is enabled.
 *
 * For example, if status is 1 and
 * classx is 3, then call waiting is enabled for data
 * and voice and disabled for everything else
 *
 * return  RIL_Errno
 */
extern RIL_Errno Ril_SS_Request_Query_Call_Waiting(RIL_SIM_ID sid, int class, RIL_SS_REQUEST_QUERY_CALL_WAITING *result);

/**
 * Configure current call waiting state (AT+CCWA=1,<mode>,<class>)
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) wait:   RIL_SS_REQUEST_SET_CALL_WAITING *
 *
 * return  RIL_Errno
 */
extern RIL_Errno Ril_SS_Request_Set_Call_Waiting(RIL_SIM_ID sid, RIL_SS_REQUEST_SET_CALL_WAITING *wait);

/**
 * Indicates incoming (received) USSD information. (+CUSD:)
 * +CUSD:<m>[,<str>,<dcs>]
 *
 * param (in) sid:  RIL_SIM_ID
 * param (in) s:  const char *
 * return  void
 */
extern void Ril_SS_Response_Cusd(RIL_SIM_ID sid, const char *s);

/* interface for SERVICE SS end */

/**
 * Ril indicate that it is ready.
 * param (in) void
 * return  BOOL
 */
extern void Ril_Ril_Ready_ind(void);

#ifdef __cplusplus
}
#endif

#endif /*RIL_H*/
